//
//  JLJsonTool.m
//  flutter_jl_bluetooth_plugin
//
//  Created by 凌煊峰 on 2021/7/23.
//

#import "JLJsonTool.h"

@implementation JLJsonTool

+ (NSString *)jsonStringFromJsonObjectConvert:(nullable id)object {
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object options:NSJSONWritingPrettyPrinted error:nil];
    NSString *dataStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    return dataStr;
}

+ (nullable id)jsonObjectFromJsonStirng:(NSString *)jsonString {
    NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
    id tempObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
    return tempObject;
}

@end
